import { existsSync, readdirSync, statSync } from 'node:fs'
import {dirname, resolve} from 'node:path'
import { fileURLToPath } from 'node:url'

export const NODE_ENV_ENUM = {
  development:'development',
  production:'production'
}

export const packagesDir = resolve(dirname(fileURLToPath(import.meta.url)),'../packages')
export const packages = readdirSync(packagesDir).filter(packageName => {
  return statSync(`${packagesDir}/${packageName}`).isDirectory() &&
         existsSync(`${packagesDir}/${packageName}/package.json`)
})